1 Public Class FrmBUSINESS_INFO
2
3     Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
4         If Not IsNumeric(txtvat.Text) Then
5             MsgBox(
"Vat should be numeric !!", MsgBoxStyle.Exclamation, "Sales and Inventory")
6             Exit Sub
7         End If
8         If sqlDT.Rows.Count >
0 Then
9             
'edit
10             sqlSTR =
"UPDATE TBL_GlobalData SET BussName ='" & txtbusname.Text & "', " _
11                                     & 
"BussLocation ='" & txtbusaddress.Text & "', " _
12                                     & 
"BussContact ='" & txtno.Text & "', " _
13                                     & 
"BussVat =" & txtvat.Text & ", " _
14                                     & 
"Tin ='" & txttin.Text & "', " _
15                                     & 
"Busslocal ='" & txtlocal.Text & "', " _
16                                     & 
"Email_Address ='" & txtemail.Text & "', " _
17                                     & 
"Website ='" & txtwebsite.Text & "'"
18             ExecuteSQLQuery(sqlSTR)
19             Audit_Trail(xUser_ID, TimeOfDay,
"Edit Bussiness Info")
20         Else
21             
'add
22             sqlSTR =
"INSERT INTO TBL_GlobalData (BussName, BussLocation, BussContact, BussVat, Tin, Busslocal, email_Address, Website) " & _
23                      
"VALUES ('" & txtbusname.Text & "', " _
24                              & 
"'" & txtbusaddress.Text & "', " _
25                              & 
"'" & txtno.Text & "', " _
26                              & CDbl(txtvat.Text) &
", " _
27                              & 
"'" & txttin.Text & "', " _
28                              & 
"'" & txtlocal.Text & "', " _
29                              & 
"'" & txtemail.Text & "', " _
30                              & 
"'" & txtwebsite.Text & "')"
31             
'MsgBox(sqlSTR)
32             ExecuteSQLQuery(sqlSTR)
33             Audit_Trail(xUser_ID, TimeOfDay,
"Add Business Info")
34
35         End If
36         MsgBox(
"Records successfuly update !!", MsgBoxStyle.Information, "Sales and Inventory")
37         ExecuteSQLQuery(
"SELECT * FROM TBL_GlobalData")
38         If sqlDT.Rows.Count >
0 Then
39             VAT = sqlDT.Rows(
0)("BussVat")
40             ParamCompanyName.Value = sqlDT.Rows(
0)("BussName")
41             ParamCompanyLoc.Value = sqlDT.Rows(
0)("BussLocation")
42             ParamCompanyContact.Value = sqlDT.Rows(
0)("BussContact")
43             ParamCompanyTIN.Value = sqlDT.Rows(
0)("Tin")
44         End If
45         Me.Close()
46     End Sub
47
48     Private Sub txtvat_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtvat.TextChanged
49         txtvat.Text = str_Filter(txtvat,
48, 57, 0, 0)
50     End Sub
51
52     Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
53         Me.Close()
54     End Sub
55
56     Private Sub FrmBUSINESS_INFO_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
57         sqlSTR =
"SELECT * FROM TBL_Globaldata"
58         ExecuteSQLQuery(sqlSTR)
59         If sqlDT.Rows.Count >
0 Then
60             txtbusID.Text = sqlDT.Rows(
0)("Buss_ID")
61             txtbusname.Text = sqlDT.Rows(
0)("BussName")
62             txtbusaddress.Text = sqlDT.Rows(
0)("BussLocation")
63             txtvat.Text = sqlDT.Rows(
0)("BussVat")
64             txtno.Text = sqlDT.Rows(
0)("BussContact")
65             txttin.Text = sqlDT.Rows(
0)("Tin")
66             txtlocal.Text = sqlDT.Rows(
0)("busslocal").ToString
67             txtemail.Text = sqlDT.Rows(
0)("email_address").ToString
68             txtwebsite.Text = sqlDT.Rows(
0)("website").ToString
69         End If
70         txtbusname.Select()
71     End Sub
72
73     Private Sub txtemail_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtemail.TextChanged
74         txtemail.Text = str_Filter(txtemail,
46, 122, 64, 1)
75     End Sub
76 End Class


Gõ tìm kiếm nhanh...